#!/usr/bin/perl -w
#
#   This script split the first string and compare each word
#   with the second string.
#
#   usage: single_words.pl string1 string2
#
# Author: Facundo Ferrer <facundo.j.ferrer@intel.com>
#

#print "un argument:".($#ARGV + 1);

my $ARGS = ($#ARGV+1);
my $STRING_1 = $ARGV[0];
my $STRING_2 = $ARGV[1];
my $MATCH = 0;
my $NOT_MATCH = 0;
my @WORDS;
my $WORD;

#print "\n\n\n";

if ($ARGS != 2) {

    print "Exit status: 1\n";
    print "You have to give two arguments";

}else{

    @WORDS = split(' ',$STRING_1);

    foreach $WORD (@WORDS) {

	if ($STRING_2=~/$WORD/) {
	    $MATCH = 1;
	}
	}		
		
    if ($MATCH) 	{
	print $MATCH;
    }else{
	print $NOT_MATCH;
    }	
	}
